// 引入全局mixin
import mixin from 'uview-plus/libs/mixin/mixin'
// 小程序特有的mixin
import mpMixin from 'uview-plus/libs/mixin/mpMixin'
// 全局挂载引入http相关请求拦截插件
import Request from 'uview-plus/libs/luch-request'

// 路由封装
import route from 'uview-plus/libs/util/route'
// 颜色渐变相关,colorGradient-颜色渐变,hexToRgb-十六进制颜色转rgb颜色,rgbToHex-rgb转十六进制
import colorGradient from 'uview-plus/libs/function/colorGradient'

// 规则检验
import test from 'uview-plus/libs/function/test'
// 防抖方法
import debounce from 'uview-plus/libs/function/debounce'
// 节流方法
import throttle from 'uview-plus/libs/function/throttle'
// 公共文件写入的方法
import index from 'uview-plus/libs/function/index'

// 配置信息
import config from 'uview-plus/libs/config/config'
// props配置信息
import props from 'uview-plus/libs/config/props'
// 各个需要fixed的地方的z-index配置文件
import zIndex from 'uview-plus/libs/config/zIndex'
// 关于颜色的配置，特殊场景使用
import color from 'uview-plus/libs/config/color'
// 平台
import platform from 'uview-plus/libs/function/platform'

const $u = {
  route,
  date: index.timeFormat, // 另名date
  colorGradient: colorGradient.colorGradient,
  hexToRgb: colorGradient.hexToRgb,
  rgbToHex: colorGradient.rgbToHex,
  colorToRgba: colorGradient.colorToRgba,
  test,
  type: ['primary', 'success', 'error', 'warning', 'info'],
  http: new Request(),
  config, // uView配置信息相关，比如版本号
  zIndex,
  debounce,
  throttle,
  mixin,
  mpMixin,
  props,
  ...index,
  color,
  platform,
}
$u.config.unit = 'rpx'
// $u挂载到uni对象上
uni.$u = $u
